package com.gxa.admin.controller;


import com.gxa.common.vo.JsonResult;
import com.gxa.common.vo.PageRecv;
import com.gxa.common.vo.ResultVo;
import com.gxa.modules.pojo.Loanafter_Checkreport;
import com.gxa.modules.pojo.Loanafter_Warning;
import com.gxa.modules.service.Loanafter_CheckReportService;
import com.gxa.modules.service.Loanafter_WarningService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "数据test",tags = "贷后管理——贷后预警——张剑宇")
@RestController

//1.新增贷后预警
@RequestMapping("/loanafter")

public class Loanafter_WarningController {

    @Autowired(required = false)
    private Loanafter_WarningService loanafter_WarningService;

   //@RequiresPermissions("/home/afterloan/addwarning")
    @PostMapping("/loanafter_warning/add")
    @ApiOperation(value = "增加贷后预警",notes = "贷后预警实体",httpMethod = "POST", response = ResultVo.class)

    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=400,message="坏请求"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=405,message="Method请求错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })

    public ResultVo add(@RequestBody @ApiParam(name = "loanafter_checkreport",value = "贷后检查报告实体",required = true) Loanafter_Warning loanafter_warning){

        ResultVo r=loanafter_WarningService.addWarning(loanafter_warning);
        return r;
    }
    //2.查询贷后预警
   //@RequiresPermissions("/home/afterloan/warning")
        @PostMapping("/loanafter_warning/query")
        @ApiOperation(value = "查询贷后预警",notes = "贷后预警实体",httpMethod = "POST", response = ResultVo.class)

        @ApiResponses({
                @ApiResponse(code=200,message="请求成功"),
                @ApiResponse(code=400,message="坏请求"),
                @ApiResponse(code=404,message="找不到页面"),
                @ApiResponse(code=405,message="Method请求错误"),
                @ApiResponse(code=500,message="后台服务错误")
        })

        public JsonResult query(@RequestBody @ApiParam(name = "pageRecv",value = "贷后预警报告实体",required = true) PageRecv<Loanafter_Warning> pageRecv){

            JsonResult r=loanafter_WarningService.queryWarning(pageRecv);
            return r;
        }

    //2.查询贷后预警
    @PostMapping("/loanafter_warning/querybyid")
   //@RequiresPermissions("/home/afterloan/warning")
    @ApiOperation(value = "查询贷后预警",notes = "贷后预警实体",httpMethod = "POST", response = ResultVo.class)

    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=400,message="坏请求"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=405,message="Method请求错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })

    public Loanafter_Warning querybyid(@RequestParam(name = "id",required = true) Integer id){

        Loanafter_Warning r=loanafter_WarningService.queryWarningById(id);
        return r;
    }

    //3.修改贷后预警
    @PostMapping("/loanafter_warning/update")
   //@RequiresPermissions("/home/afterloan/warning")
    @ApiOperation(value = "增加贷后检查报告",notes = "贷后检查报告实体",httpMethod = "POST", response = ResultVo.class)

    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=400,message="坏请求"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=405,message="Method请求错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })

    public ResultVo update(@RequestBody @ApiParam(name = "loanafter_warning",value = "贷后预警报告实体",required = true) Loanafter_Warning loanafter_warning){

        ResultVo r=loanafter_WarningService.upadeWarning(loanafter_warning);
        return r;
    }
}
